package com.ruoyi.dao;

import com.ruoyi.model.TestInfo;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class TestDao {

    @Resource
    private JdbcTemplate jdbcTemplate;


    public int addTest(TestInfo entity) {

        StringBuffer sb = new StringBuffer("insert into test ");
        sb.append("(foo, bar )");
        sb.append("values(?,?)");
        String sql=sb.toString();

        Object[] params = new Object[]{
                entity.getFoo(), entity.getBar()
        };

        return  jdbcTemplate.update(sql, params);
    }

}
